
FROM python:3.11-slim

RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \
    libgl1-mesa-glx \
    libjemalloc-dev \
    vim \
    git

RUN useradd -m -s /bin/bash user && \
    mkdir -p /home/user && \
    chown -R user /home/user/

WORKDIR /home/user/
RUN git clone https://atomgit.com/ipex-llm/smartwriting-system as smartwriting
WORKDIR /home/user/smartwriting

RUN pip install --no-cache-dir --upgrade pip && \
pip install --pre --upgrade ipex-llm[xpu] --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/cn/ \
pip install -r requirements.txt

COPY ./avatarchatbot.py /home/user/avatarchatbot.py

USER user

WORKDIR /home/user
EXPOSE 8080

ENTRYPOINT ["python", "./server/server.py"]
